import request from '@/utils/request'
import qs from 'qs'

export const getFileManagerList = (params) => {
    return new request({
        url: './web-data-personal/file/fileManagers',
        method: 'get',
        params: params
    });
}

export const getFileManagerById = (params) => {
    return new request({
        url: './web-data-personal/file/fileManagers/' + params.id,
        method: 'get',
    });
}

export function saveOrUpdateFileManager(params) {
    return new request({
        url: './web-data-personal/file/fileManagers',
        method: (params.id ? 'put' : 'post'),
        data: params
    });
}

export function deleteFileManagerById(id) {
    return new request({
        url: './web-data-personal/file/fileManagers/' + id,
        method: 'delete',
    });
}

//Minio附件上传的接口。统一放在附件存储桶中。
export function uploadFile(params) {
    return new request({
        url: './web-data-minio/minio/files/upload',
        method: 'post',
        data: params
    });
}

//Minio附件下载的接口。统一从附件存储桶中下载。
export const downloadFile = (params) => {
    return new request({
        url: './web-data-minio/minio/files/download',
        method: 'get',
        params: params,
        responseType:'blob'
    });
}
//获取minio 信息。
export const screenshotInfo = (params) => {
    return new request({
        url: './web-data-minio/minio/files/screenshotInfo',
        method: 'get',
        params: params,
    });
}
export const newrecord = (params) => {
    return new request({
        url: './web-data-personal/file/fileManagers',
        method: 'post',
        data: params
    });
}